﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/Default/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<Fashion.ViewModels.ProductViewModel>" %>


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Submenu" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="NoFormMainContent" runat="server">
                
    <form action="/Admin/Update" method="post" enctype="multipart/form-data">
    <table>
        <tr>
            <td>
                Product ID
            </td>
            <td>
                <input type="text" id="ProductID" name="ProductID" value="<%: Model.product.ProductID %>" readonly="readonly" />
            </td>
        </tr>
        <tr>
            <td>
                Product Name
            </td>
            <td>
                <input type="text" id="ProductName" name="ProductName" value="<%: Model.product.ProductName %>" />
            </td>
        </tr>
        <tr>
            <td>
                Category
            </td>
            <td>
            <%var index = 0;
              foreach (var category in Model.Category)
              {%>
               <% if (index == Model.product.CategoryID-1)
                  { %>
                    <input name="CategoryID" type="radio" id="Cat_<%: Model.CatID[index] %>" value = "<%: Model.CatID[index] %>" checked="checked" />
                <% }
                  else
                  {%>
                    <input name="CategoryID" type="radio" id="Radio1" value = "<%: Model.CatID[index] %>" />
                    <%} %>
                <label for="Cat_<%:Model.CatID[index] %>"><%:category %></label> <br />
            <%
                index = index + 1;
              } %>
                
            </td>
        </tr>
        <tr>
            <td>
                Brand
            </td>
            <td>
            <%index = 0;
              foreach (var brand in Model.Brand)
              {%>
              <% if (index == Model.product.BrandID-1)
                 { %>
                    <input name="BrandID" type="radio" id="Brand_<%: Model.BrandID[index]%>" value = "<%: Model.BrandID[index] %>" checked="checked" />
                <% }
                 else
                 {%>
                    <input name="BrandID" type="radio" id="Brand_<%: Model.BrandID[index] %>" value = "<%: Model.BrandID[index] %>"/>
                 <% } %>
            <label for="Cat_<%:Model.BrandID[index] %>"><%:brand %></label> <br />
            <%
                index = index + 1;
              } %>
              </td>
        </tr>
        <tr>
            <td>
                Price:
            </td>
            <td>
                <input type="text" id="Price" name="Price" value="<%: Model.product.Price %>" />
            </td>
        </tr>
        <tr>
            <td>
                Current ImageList
            </td>
            <td>
                <input type="text" name="Image" id="Image" value="<%: Model.product.ImageList %>" readonly="readonly" />
            </td>
        </tr>
        <tr>
            <td>
                Add More Images
            </td>
            <td>
                <div id="files_list">
                <input type="file" name="ImageLists" id="ImageLists" value="<%: Model.product.ImageList %>" />
                <input type="button" name="Add" value="More" onclick=" return add()" />
                </div>
            </td>
        </tr>
        <tr>
            <td>
                Choose Color of Default Image
            </td>         
            <td>
            <% index = 0;
                foreach (var color in Model.Color)
               {%>
               <input type="radio" checked="checked" id="Color_<%: Model.ColorID[index] %>" name="ColorID" value="<%: Model.ColorID[index] %>" />
               <label for="<%: Model.ColorID[index] %>"><%:color %></label>
                <% index = index + 1; } %>
            </td>

        </tr>
        <tr>
            <td>
                Sex
            </td>
            <td>
                <select name="Sex" id="Sex">
                <% if (Model.product.Sex == "Female")
                   { %>
                    <option value="Female" selected="selected">Female</option>
                    <option value="Male" >Male</option>
                    <% }
                   else
                   { %>
                    <option value="Male" selected="selected">Male</option>
                    <option value="Female">Female</option>
                    <% } %>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                Description:
            </td>
            <td>
                <input type="text" name="Description" id="Description" value="<%: Model.product.Description %>" />
            </td>
        </tr>
        <tr>
            <td>
                Available Colors
            </td>         
            <td>
            <% index = 0;
                foreach (var color in Model.Color)
                {%>
                <% if (Model.ColorDetail.Contains(Model.ColorID[index]))
                   { %>
                        <input type="checkbox" checked="checked" id="ColorList" name="ColorList" value="<%: Model.ColorID[index] %>" />
                   <% }
                   else
                   {%>
                        <input type="checkbox" id="Checkbox1" name="ColorList" value="<%: Model.ColorID[index] %>" />
                   <% } %>
                    <label for="<%: Model.ColorID[index] %>"><%:color %></label>
                <% index = index + 1; } %>
            </td>
        </tr>
        <tr>
            <td>Available Sizes:</td>
            <td>
            <% foreach (var size in Model.Size)
               {%>
                <% if (Model.SizeDetail.Contains(size))
                { %>
                    <input type="checkbox" checked="checked" id="Size_<%: size %>" name="SizeList" value="<%: size %>" />
                 <% } else
                 { %>
                   <input type="checkbox" id="Checkbox2" name="SizeList" value="<%: size %>" />
                 <% } %>
               <label for="Size_<%: size %>"><%:size %></label>
            <% } %>
            </td>
        </tr>
    </table>
    <input type="submit" value="Save" />
    </form>


</asp:Content>